package cn.nebula.core.user.action;

import cn.nebula.core.base.action.BaseAction;
import cn.nebula.core.user.model.User;
import cn.nebula.core.user.service.UserService;

public class UserAction extends BaseAction {

	private static final long serialVersionUID = 1553740852130269460L;
	
	private UserService userService;
	
	private String loginno;
	
	public String getLoginno() {
		return loginno;
	}

	public void setLoginno(String loginno) {
		this.loginno = loginno;
	}

	public String getLoginpwd() {
		return loginpwd;
	}

	public void setLoginpwd(String loginpwd) {
		this.loginpwd = loginpwd;
	}

	private String loginpwd;
	
	public String doSave(){
		return SUCCESS;
	}
	
	public String doLogin(){
//		User user=(User)getValObj();
		try {
			User loginUser=userService.doLogin(loginno, loginpwd);
			if(loginUser==null){
				this.addActionMessage("Exception: The user not exit");
				return INPUT;
			}
		} catch (Exception e) {
			this.addActionMessage("Exception: "+e.getMessage());
			return INPUT;
		}
		return SUCCESS;
	}
	
	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}
}
